Skip to content

fix(bundles): add configure/terminfo bundle — install alacritty terminfo on remote hosts - #135

Closed
t0kubetsu wants to merge 1 commit into
devfrom
fix/admin-services-lab-alacritty-terminfo
Closed

fix(bundles): add configure/terminfo bundle — install alacritty terminfo on remote hosts#135
t0kubetsu wants to merge 1 commit into
devfrom
fix/admin-services-lab-alacritty-terminfo

Conversation

@t0kubetsu

Copy link
Copy Markdown
Contributor

Summary

  • Adds bundles/core/linux/ubuntu/configure/terminfo/main.yml
  • Configures sshd to accept the TERM env var from the SSH client (AcceptEnv TERM)
  • Copies the alacritty terminfo binary from the Ansible controller to /etc/terminfo/a/alacritty on each target host

Companion to range42/range42#228 which fixes the deployer-side TERM export. This bundle fixes the server side: Ubuntu 24.04 minimal images don't ship the alacritty terminfo entry, so connecting from an Alacritty session triggers 'alacritty': unknown terminal type. on the remote.

Relates to range42/range42#227.

Usage

- import_playbook: bundles/core/linux/ubuntu/configure/terminfo/main.yml

Override hosts in the importing scenario's stage_01 to target the relevant inventory group.

Test plan

  • Run bundle against a fresh Ubuntu 24.04 VM from an Alacritty session
  • Confirm TERM=alacritty is forwarded and accepted by sshd
  • Confirm no unknown terminal type error in the remote shell

…nfo on remote hosts

Ubuntu 24.04 minimal images don't ship the alacritty terminfo entry.
SSH forwards the local TERM value, so connecting from an Alacritty
session triggers "'alacritty': unknown terminal type." on the remote.

Adds AcceptEnv TERM to sshd_config and copies /usr/share/terminfo/a/alacritty
from the Ansible controller to /etc/terminfo/a/alacritty on each target.

Relates to range42/range42#227.

pparage commented Aug 11, 2026

Copy link
Copy Markdown
Member

Review — changes requested

Adds a bundle that installs the alacritty terminfo and lets sshd accept TERM. The problem is real (#227) and the play is short, but as written it targets the whole inventory rather than the lab hosts, and its one substantive task is wrapped in ignore_errors, so the common failure mode is a green run that changed nothing. Also worth noting it is stale — opened 2026-07-15, no commits since, and dev has moved.

Blocking

  • bundles/core/linux/ubuntu/configure/terminfo/main.yml:17hosts: all, but the header comment says "scenarios import this via import_playbook … overriding hosts to the relevant inventory group". import_playbook cannot override a literal hosts:vars: on the import only feeds variables into the play, so the override only works when hosts is a template. Every other bundle in this repo does exactly that (hosts: "{{ global_vm_ssh_name }}" ×26, "{{ TARGET_GROUP }}", "{{ target_group }}"), or names a group literally.

    This is not cosmetic: scenario inventories carry proxmox: and proxmox_cli: groups (e.g. scenarios/blank_scenario_6_subnets/templates/ansible-inventory.j2), so all includes the hypervisor and the deployer. With become: true the play would rewrite /etc/ssh/sshd_config and reload sshd on the Proxmox node — well outside what a terminfo bundle should touch.

    - name: configure sshd and alacritty terminfo
      hosts: "{{ TARGET_GROUP }}"
    
  • Bundle path does not follow the repo layout. Bundles are flat dotted directories under an existing category — bundles/admin/software.install.deployer_api_backend, bundles/generic/network.baseline.ssh, bundles/proxmox/cloud_init_image.download.ubuntu_lts_minimal. This one introduces a new top-level category core/ plus a nested linux/ubuntu/configure/terminfo/ path. Categories on dev are admin, ctf, generic, proxmox, _tools — nothing resolves core/. Something like bundles/generic/terminfo.install.alacritty/ fits the existing scheme.

Non-blocking

  • main.yml:22-27 — the lineinfile on /etc/ssh/sshd_config has no validate:. The repo is editing sshd on remote hosts it reaches only over ssh, so the usual guard applies: validate: '/usr/sbin/sshd -t -f %s' refuses to write a config that would not parse. A reload will not apply a broken file, but it survives to the next restart and locks the host out then.
  • main.yml:38-44ignore_errors: true on the copy makes the bundle's only real action fail silently. src: /usr/share/terminfo/a/alacritty is read from the controller, and the deployer-cli is a headless VM that will not normally have Alacritty installed. Result: play reports ok, terminfo is absent, operator still gets 'alacritty': unknown terminal type. Either gate it on a controller-side stat with an explicit skip message, or install ncurses-term on the target and drop the controller dependency entirely.
  • main.yml:24insertafter: '^AcceptEnv LANG LC_\*' falls back to end-of-file when the pattern does not match. If the target's sshd_config ends in a Match block, AcceptEnv TERM lands inside that block and applies only to that match context. Anchoring with insertbefore: '^Match ' as a fallback, or dropping a file into /etc/ssh/sshd_config.d/, avoids the ordering question — Ubuntu 24.04 already ships the Include for it.
  • The bundle is not imported by any scenario (grep -rn "configure/terminfo" matches only the file itself), so nothing exercises it yet. That is presumably intentional pending #227, but it does mean none of the above has been run for real.

Cross-repo

  • No companion PR needed. This adds a bundle rather than renaming one, and no scenario references it, so nothing in range42-backend-api or range42-catalog resolves the name today. That changes the moment a scenario imports it — at which point the path above becomes the thing that has to be right first.

Verification

  • ansible-lint / ansible-playbook --syntax-checknot run, neither is installed in this environment and the routine does not install system-wide. Findings above are from reading the play against the repo's other bundles, not from a linter.
  • Secrets pass on the diff — clean.
  • Bundle-layout and hosts: conventions checked against all bundles on dev.

Generated by Claude Code

@t0kubetsu

Copy link
Copy Markdown
Contributor Author

Thanks for the review @pparage — the findings are correct against this diff, but the diff itself is stale: this PR's head (d850879) was carried verbatim into the fix-terminfo-bundle-to-generic branch (as 326cead) and merged to dev yesterday via #141, which already resolves both blocking items:

Your non-blocking points about ignore_errors: true, the missing sshd validate:, and the insertafter fallback do survive in the merged version — follow-up PR incoming that addresses them (plus dropping the default('all'), since scenario inventories carry proxmox/proxmox_cli groups and a forgotten terminfo_hosts would still touch sshd on the hypervisor).

Closing as superseded by #141.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants